package com.hsjk.szwj.module.system.dal.mysql.poster;

import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.framework.mybatis.core.mapper.BaseMapperX;
import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.module.system.controller.admin.poster.vo.AdminPosterPageReqVO;
import com.hsjk.szwj.module.system.controller.app.poster.vo.AppPosterPageReqVO;
import com.hsjk.szwj.module.system.dal.dataobject.poster.PosterConfigDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/12/11 15:37
 **/
@Mapper
public interface IPosterConfigMapper extends BaseMapperX<PosterConfigDO> {
    default PageResult<PosterConfigDO> selectPage(AdminPosterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PosterConfigDO>()
                .eqIfPresent(PosterConfigDO::getPosterType, reqVO.getPosterType())
                .orderByDesc(PosterConfigDO::getCreateTime));
    }

    default PageResult<PosterConfigDO> selectPage(AppPosterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PosterConfigDO>()
                .eqIfPresent(PosterConfigDO::getPosterType, reqVO.getPosterType())
                .orderByDesc(PosterConfigDO::getCreateTime));
    }
}
